using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy : Character
{
    private bool isFrozenTime;

    public virtual void FreezeTime(bool isFreeze)
    {
        isFrozenTime = isFreeze;
        if (isFreeze)
            anim.speed = 0;
        else
            anim.speed = 1;
    }

    public void FreezeTimeFor(float time) => StartCoroutine(FreezeTimeForAsync(time));
    public virtual IEnumerator FreezeTimeForAsync(float time)
    {
        if (time <= 0)
            yield break;
        FreezeTime(true);
        yield return new WaitForSeconds(time);
        FreezeTime(false);
    }
}
